﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using StudyTracker.Domain.Entities;

namespace StudyTracker.Web.Models.Data
{
	public class AddSingleModel
	{
		[Required(ErrorMessage = "Please enter a subject.")]
		public string Subject { get; set; }

		[Required(ErrorMessage = "Please enter an amount.")]
		public double? Amount { get; set; }

		public IEnumerable<string> Subjects { get; private set; }

		public AddSingleModel(Student student)
		{
			Subjects = student.Subjects.Select(x => x.Name);
		}

		public AddSingleModel() { }
	}
}